/************************************************************************

								Heroes IV
					  Copyright 2001, The 3DO Company

	------------------------------------------------------------------
  						       dialog_caravan_view.h

	$Header: $

	$NoKeywords: $

 ************************************************************************/

#ifndef DIALOG_CARAVAN_VIEW_H_INCLUDED
#define DIALOG_CARAVAN_VIEW_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>

#include "bitmap_group_ptr.h"
#include "bitmap_layer_window_ptr.h"
#include "creature_info_window_ptr.h"
#include "game_window.h"
#include "text_window_ptr.h"

class t_adventure_map;
class t_button;
class t_caravan;
class t_scrollbar;
class t_town;

// ---------------------------------------------------------------------------
// Dialog to view caravans -- either all caravans or all caravans heading 
// towards a given town
// ---------------------------------------------------------------------------
class t_dialog_caravan_view : public t_window
{
	public:
		t_dialog_caravan_view( t_window * parent, t_adventure_map & map );

		bool init_dialog( t_town * town );

	private:
		enum { k_displayed_caravans = 3 };

		typedef std::vector< t_caravan const * > t_caravan_array;

		struct t_visible_caravan
		{
			t_bitmap_window_ptr			m_flag;
			t_text_window_ptr			m_days;
			t_text_window_ptr			m_days_subtext;
			t_text_window_ptr			m_location;
			t_creature_info_window_ptr	m_creatures;
		};

		void add_caravans_for_town( t_town * town, int ignore_player_number );
		void close_clicked( t_button * );
		void selection_changed( t_creature_info_window *, int selected_creature, int visible_index );
		void scroll( t_scrollbar *, int position );
		void update_visible( int visible_index );

		t_bitmap_group_ptr						m_bitmaps;
		t_caravan_array							m_caravans;
		int										m_first_visible_caravan;
		t_bitmap_group_ptr						m_flag_bitmaps_ptr;
		t_adventure_map &						m_map;
		t_visible_caravan						m_visible_caravans[ k_displayed_caravans ];
};


#endif // DIALOG_CARAVAN_VIEW_H_INCLUDED
